/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package manager;

import Entity.Author;
import iface.IManager;
import java.util.ArrayList;
/**
 *
 * @author BinhNV_A04911
 */
public class AuthorManager implements IManager<Author>{
    private  ArrayList<Author> authorList;
    public AuthorManager(){
        this.authorList=new ArrayList<Author>();

    }

    public boolean add(Author obj) {
        return this.authorList.add(obj);
    }

    public boolean remove(Author obj) {
       return this.authorList.remove(obj);
    }

    public Author replace(int index, Author obj) {
        return this.set(index,obj);
    }

    public int size() {
       return this.authorList.size();
    }

    public Author get(int index) {
       return this.authorList.get(index);
    }

    public Author getById(int id) {
      for(Author author:this.authorList){
          if(Integer.valueOf(author.getAuthorID())==id)
              return author;


      }
        return  null;
    }

    public Author getByName(String name) {
      for(Author obj:this.authorList){
          if(obj.equals(obj)){
              return  obj;
          }
      }
      return null;
    }

    public void setVisible(Author obj, boolean value) {
       for(Author object:this.authorList){
           if(object.getAuthorName().equals(object.getAuthorID())){

              break;
           }
     }

   }
   private Author set(int index, Author obj) {
        return this.set(index,obj);
    }


}
